﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace SwirlTree
{
    class Vector2D
    {
        public double _x, _y;

        public Vector2D(double x, double y)
        {
            _x = x;
            _y = y;
        }

        public Vector2D rotate(double angle)
        {
            double nx = _x * Math.Cos(angle) - _y * Math.Sin(angle);
            double ny = _x * Math.Sin(angle) + _y * Math.Cos(angle);
            return new Vector2D(nx, ny);
        }

        public Point getPoint()
        {
            return new Point((int)_x, (int)_y);
        }

        public static Vector2D operator +(Vector2D v1, Vector2D v2)
        {
            return new Vector2D(v1._x + v2._x, v1._y + v2._y);
        }
        public static Vector2D operator -(Vector2D v1, Vector2D v2)
        {
            return new Vector2D(v1._x - v2._x, v1._y - v2._y);
        }
        public static Vector2D operator *(Vector2D v, double f)
        {
            return new Vector2D(v._x * f, v._y * f);
        }
    }
}
